<script type="text/javascript">
    msg1 = 'Like page and close opened window...';
    msg2 = 'We cannot contact facebook...';
    msg3 = 'Facebook says you haven\'t liked this page!';
    msg4 = 'SUCCESS!';
    msg5 = ' <b>coins</b> were added to your account!';
    var report_msg1 = 'Are you sure you want to report this page?';
    var report_msg2 = 'Page was successfully reported!';
    var report_msg3 = 'An unexpected error occurred!';
    var start_click = 1;
    var end_click = 14;

    function report_page(a, b, c) {
        var r = confirm(report_msg1);
        if (r == true) {
            $.ajax({
                type: "POST",
                url: "system/report.php",
                cache: false,
                data: "id=" + a + "&url=" + b + "&module=" + c,
                success: function (d) {
                    if (d == 1) {
                        alert(report_msg2);
                        skipuser(a, '1')
                    } else {
                        $("#Hint").html("<div class=\"msg\"><div class=\"error\">" + report_msg3 + "</div></div>")
                    }
                }
            })
        }
    }
    hideref = 1;

    function click_refresh() {
        if (start_click < end_click) {
            start_click = start_click + 1
        } else {
            location.reload(true)
        }
    }
    function skipuser(b, d) {
        $("#Hint").html("<img src=\"img/loader.gif\" /><br>");
        $.ajax({
            type: "POST",
            url: "system/modules/facebook/process.php",
            data: "step=skip&sid=" + b,
            success: function (a) {
                $("#Hint").html(a);
                remove(b);
                click_refresh()
            }
        })
    }
    var targetWin;

    function ModulePopup(d, e, f, w, h, g, i) {
        if (targetWin && !targetWin.closed) {
        } else {
            var j = screen.width / 2 - w / 2;
            var k = screen.height / 2 - h / 2;
            var l = e;
            $("#Hint").html("<img src=\"img/loader.gif\" /><br>");
            $.ajax({
                type: "POST",
                url: "system/modules/facebook/process.php",
                data: "get=1&url=" + e + "&pid=" + d,
                success: function (a) {
                    if (!isNaN(a)) {
                        $("#Hint").html("<div class=\"msg\"><div class=\"info\">" + msg1 + "</div></div>");
                        var b = setTimeout(function () {
                            targetWin.close()
                        }, 20000);
                        var c = setInterval(function () {
                            if (targetWin.closed) {
                                clearTimeout(c);
                                clearTimeout(b);
                                do_click(d, g, i)
                            }
                        }, 1000)
                    } else {
                        $("#Hint").html("<div class=\"msg\"><div class=\"error\">" + msg2 + "</div></div>")
                    }
                }
            });
            if (hideref) {
                l = 'http://hideref.org/?' + e
            }
            targetWin = window.open(l, f, "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=" + w + ", height=" + h + ", top=" + k + ", left=" + j)
        }
    }
    function do_click(b, c, e) {
        $("#Hint").html("<img src=\"img/loader.gif\" /><br>");
        var d = $("#c_coins").html();
        $.ajax({
            type: "POST",
            url: "system/modules/facebook/process.php",
            cache: false,
            data: "type=1&id=" + b,
            success: function (a) {
                if (a == 1) {
                    $("#Hint").html("<div class=\"msg\"><div class=\"success\">" + msg4 + " <b>" + c + "</b>" + msg5 + "</div></div>");
                    remove(b);
                    click_refresh();
                    $("#c_coins").html(parseInt(c) + parseInt(d))
                } else {
                    $("#Hint").html("<div class=\"msg\"><div class=\"error\">" + msg3 + "</div></div>")
                }
            }
        })
    }
    function remove(a) {
        document.getElementById(a).style.display = "none"
    }
</script>

<style type="text/css">
    p {
        color: #fff;
    }
</style>